<template>
  <div v-if="!isTask">
    <el-tag type="primary" :size="size" v-if="instance.result === 'RUNNING'">{{instance.status}}</el-tag>
    <el-tag type="danger" :size="size" v-else-if="instance.result === 'REFUSE'">{{instance.status}}</el-tag>
    <el-tag type="info" :size="size" v-else-if="instance.result === 'CANCEL'">{{instance.status}}</el-tag>
    <el-tag type="success" :size="size" v-else>{{ $t('webAuto.Approved') }}</el-tag>
  </div>
  <el-tag v-else :type="(taskStatus[instance.taskResult] || {}).type">
    {{ (taskStatus[instance.taskResult] || {}).text }}
  </el-tag>
</template>

<script>
export default {
  name: 'ProcessStatus',
  components: {},
  props: {
    instance: {
      type: Object,
      default: () => {
        return {}
      },
    },
    size: {
      type: String,
      default: 'medium',
    },
    isTask: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      taskStatus: {
        agree: { type: 'success', text: this.$t('webAuto.Agreed') },
        complete: {type: 'success', text: this.$t('webAuto.AlreadyProcessed')},
        refuse: { type: 'danger', text: this.$t('webAuto.REJECTED') },
        recall: { type: 'warning', text: this.$t('webAuto.RETURNED') },
        transfer: { type: 'primary', text: this.$t('webAuto.Transferred') },
      },
    }
  },
  methods: {},
}
</script>

<style scoped></style>
